<#assign title="导航菜单列表页面">
<#include "/admin/inc/top.html"/>
<div class="main-content" id="main-content">
    <style>
        .left-menu-tree {
            height: 100%;
            width: 300px;
            float: left;
            box-shadow: 2px 0px 4px #bbbaba;
        }

        .right-op {
            margin-left: 320px;
            height: 100%;
        }
    </style>

    <section class="content">
        <div class="panel-body" style="padding-top: 50px;">
            <aside class="left-menu-tree">
                <header class="header navbar clearfix bb">
                    <p class="navbar-text"><i class="fa fa-sitemap mr5"></i>系统菜单</p>
                    <a class="btn btn-primary navbar-btn" href="/private/fof/sysMenu/add" data-pjax="">
                        <i class="fa fa-plus"></i> 添加</a>
                </header>
                <div class="content-wrap no-p">
                    <ul id="treeDemo" class="ztree"></ul>
                </div>
            </aside>
            <section class="right-op">
                <section class="panel panel-form">
                    <form id="unitUpdateForm" role="form" class="form-horizontal parsley-form" data-parsley-validate
                          action="${base!}/private/fof/sysMenu/addDo" method="post">
                        <div class="row mb10">
                            <div class="col-lg-12">
                                <div class="form-group">
                                    <label for="parentName" class="col-sm-2 control-label">父级名称</label>

                                    <div class="col-sm-8">
                                        <input type="hidden" id="parentId" name="parentId">
                                        <input disabled type="text" id="parentName" class="form-control" name="parentName"
                                               placeholder="父级名称">
                                    </div>
                                </div>
                                <div class="hr-line-dashed"></div>
                                <div class="form-group">
                                    <label for="name" class="col-sm-2 control-label">菜单名称</label>

                                    <div class="col-sm-8">
                                        <input type="text" id="name" class="form-control" name="name"
                                               placeholder="菜单名称">
                                    </div>
                                </div>
                                <div class="hr-line-dashed"></div>
                                <div class="form-group">
                                    <label for="aliasName" class="col-sm-2 control-label">菜单别名</label>

                                    <div class="col-sm-8">
                                        <input type="text" id="aliasName" class="form-control" name="aliasName"
                                               placeholder="菜单别名">
                                    </div>
                                </div>
                                <div class="hr-line-dashed"></div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">资源类型</label>

                                    <div class="col-sm-8">
                                        <input class="ichk" id="dataType" type="radio" name="type" value="1"> <label for="dataType">数据</label>
                                        <input class="ichk" id="menuType" type="radio" name="type" value="1"> <label for="menuType">菜单</label>
                                    </div>
                                </div>
                                <div class="hr-line-dashed"></div>
                                <div class="form-group">
                                    <label for="href" class="col-sm-2 control-label">菜单链接</label>

                                    <div class="col-sm-8">
                                        <input type="text" id="href" class="form-control" name="href"
                                               placeholder="菜单链接">
                                    </div>
                                </div>
                                <div class="hr-line-dashed"></div>
                                <div class="form-group">
                                    <label for="target" class="col-sm-2 control-label">打开方式</label>

                                    <div class="col-sm-8">
                                        <select class="input-medium form-control" id="target" name="target">
                                            <option value="data-pjax">pjax方式</option>
                                            <option value="blank">外部页面</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="hr-line-dashed"></div>
                                <div class="form-group">
                                    <label for="icon" class="col-sm-2 control-label">菜单图标</label>

                                    <div class="col-sm-8">
                                        <input type="text" id="icon" class="form-control" name="icon"
                                               placeholder="菜单图标">
                                    </div>
                                </div>
                                <div class="hr-line-dashed"></div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">是否显示</label>

                                    <div class="col-sm-8">
                                        <input class="ichk" id="notShow" type="radio" name="isShow" value="0"> <label for="notShow">隐藏</label>
                                        <input class="ichk" id="show" type="radio" name="isShow" value="1"> <label for="show">显示</label>
                                    </div>
                                </div>
                                <div class="hr-line-dashed"></div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">是否禁用</label>

                                    <div class="col-sm-8">
                                        <input class="ichk" id="disabled1" type="radio" name="disabled" value="0"> <label for="disabled1">禁用</label>
                                        <input class="ichk" id="disabled2" type="radio" name="disabled" value="1"> <label for="disabled2">正常</label>
                                    </div>
                                </div>
                                <div class="hr-line-dashed"></div>
                            </div>
                        </div>
                        <div class="col-lg-3"></div>
                        <div class="col-lg-6">
                            <div class="form-group text-center">
                                <label></label>

                                <div>
                                    <button class="btn btn-primary btn-block btn-lg btn-parsley"
                                            data-loading-text="正在提交...">提 交
                                    </button>
                                </div>
                            </div>
                        </div>
                    </form>
                </section>
            </section>
        </div>
        <!-- 删除导航菜单 -->
        <div id="dialogDelete" class="modal fade bs-modal-sm" tabindex="-2" role="dialog" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                        <h4 class="modal-title">删除导航菜单</h4>
                    </div>
                    <div class="modal-body">
                        <div class="row">
                            <div class="col-xs-12">
                                导航菜单删除后无法恢复，确定删除吗？ <br/>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取 消</button>
                        <button id="okDel" type="button" class="btn btn-primary" data-loading-text="正在删除...">确 定</button>
                    </div>
                </div>
            </div>
        </div>
        <!-- 删除选中导航菜单 -->
        <div id="dialogDeleteCheck" class="modal fade bs-modal-lg" tabindex="-2" role="dialog" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                        <h4 class="modal-title">删除导航菜单</h4>
                    </div>
                    <div class="modal-body">
                        <div class="row">
                            <div class="col-xs-12 mb10">
                                导航菜单删除后无法恢复，确定删除已选导航菜单吗？
                            </div>
                            <div class="col-xs-12">
                                <ul id="checkedUser" class="list-group"></ul>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取 消</button>
                        <button id="ok" type="button" class="btn btn-primary" data-loading-text="正在删除...">确 定</button>
                    </div>
                </div>
            </div>
        </div>
        <!-- 导航菜单详情 -->
        <div id="dialogUserDetail" class="modal fade bs-modal-sm" data-autoClear tabindex="-3" role="dialog" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">

                </div>
            </div>
        </div>
    </section>
</div>
<script type="text/javascript">




    function del(ids){
        var dialog = $("#dialogDeleteCheck");
        dialog.modal("show");
        dialog.find("#ok").unbind("click");
        dialog.find("#ok").bind("click", function (event) {
            var btn = $(this);
            btn.button("loading");
            $.post("${base!}/private/fof/sysMenu/delete", {ids: ids.toString()}, function (data) {
                if (data.code == 200) {
                    datatable.ajax.reload(null,false);
                } else {
                    Toast.error(data.msg);
                }
                btn.button("reset");
                dialog.modal("hide");
            }, "json");
        });
    }

    function delCheck() {
        var chks = datatable.rows('.selected').data();
        if (chks.length > 0) {
            var ids = [];
            $.each(chks, function (i, n) {
                ids.push(n.id);
            });
            del(ids);
        } else {
            Toast.warning("请先选择要删除的导航菜单！");
        }
    }

    function update(id) {
        pjaxPage('/private/fof/sysMenu/edit/'+id);
    }

    $(document).ready(function () {

    });
</script>

    <SCRIPT type="text/javascript">
        <!--
        var setting = {
            data: {
                simpleData: {
                    enable: true
                }
            }
        };

        var zNodes =[
            { id:1, pId:0, name:"父节点1 - 展开", open:true},
            { id:11, pId:1, name:"父节点11 - 折叠"},
            { id:111, pId:11, name:"叶子节点111"},
            { id:112, pId:11, name:"叶子节点112"},
            { id:113, pId:11, name:"叶子节点113"},
            { id:114, pId:11, name:"叶子节点114"},
            { id:12, pId:1, name:"父节点12 - 折叠"},
            { id:121, pId:12, name:"叶子节点121"},
            { id:122, pId:12, name:"叶子节点122"},
            { id:123, pId:12, name:"叶子节点123"},
            { id:124, pId:12, name:"叶子节点124"},
            { id:13, pId:1, name:"父节点13 - 没有子节点", isParent:true},
            { id:2, pId:0, name:"父节点2 - 折叠"},
            { id:21, pId:2, name:"父节点21 - 展开", open:true},
            { id:211, pId:21, name:"叶子节点211"},
            { id:212, pId:21, name:"叶子节点212"},
            { id:213, pId:21, name:"叶子节点213"},
            { id:214, pId:21, name:"叶子节点214"},
            { id:22, pId:2, name:"父节点22 - 折叠"},
            { id:221, pId:22, name:"叶子节点221"},
            { id:222, pId:22, name:"叶子节点222"},
            { id:223, pId:22, name:"叶子节点223"},
            { id:224, pId:22, name:"叶子节点224"},
            { id:23, pId:2, name:"父节点23 - 折叠"},
            { id:231, pId:23, name:"叶子节点231"},
            { id:232, pId:23, name:"叶子节点232"},
            { id:233, pId:23, name:"叶子节点233"},
            { id:234, pId:23, name:"叶子节点234"},
            { id:3, pId:0, name:"父节点3 - 没有子节点", isParent:true}
        ];

        $(document).ready(function(){
            $.fn.zTree.init($("#treeDemo"), setting, zNodes);
        });
        //-->
    </SCRIPT>

<#include "/admin/inc/bottom.html"/>